﻿Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Data
Imports DoAnQuanLyBanHang1065043_1065007.DoAnQuanLyBanHang.DTO
Imports System.Windows.Forms

Namespace DoAnQuanLyBanHang.DAO
    Public Class QuyenCtrl
        Private m_QuyenData As New QuyenData()

        Public Sub HienThiComboBox(cbx As ComboBox)
            Dim m_DT As New DataTable()
            cbx.DataSource = m_DT
            cbx.DisplayMember = "TenQuyen"
            cbx.ValueMember = "MaQuyen"
        End Sub

#Region "Hien thi ComboBox trong DataGridView"
        Public Sub HienThiDataGridViewComboBoxColumn(cmbColumn As DataGridViewComboBoxColumn)
            cmbColumn.DataSource = m_QuyenData.LayQuyen()
            cmbColumn.DisplayMember = "TenQuyen"
            cmbColumn.ValueMember = "MaQuyen"
            cmbColumn.DataPropertyName = "MaQuyen"
            cmbColumn.HeaderText = "Quyền người dùng"
        End Sub
#End Region

        Public Sub HienThi(Dgv As DataGridView, bvn As BindingNavigator)
            Dim bs As New BindingSource()

            bs.DataSource = m_QuyenData.LayQuyen()
            bvn.BindingSource = bs
            Dgv.DataSource = bs
        End Sub

#Region "Them moi"
        Public Function ThemDongMoi() As DataRow
            Return m_QuyenData.ThemDongMoi()
        End Function
        Public Sub ThemMoi(m_Row As DataRow)
            m_QuyenData.ThemQuyen(m_Row)
        End Sub
#End Region

#Region "Luu"
        Public Function LuuQuyen() As Boolean
            Return m_QuyenData.LuuQuyen()
        End Function
#End Region
    End Class
End Namespace
